//
//  PKProductMainListTableViewCell.m
//  PianKe
//
//  Created by lanou on 15/9/26.
//  Copyright (c) 2015年 李伟伟. All rights reserved.
//

#import "PKProductMainListTableViewCell.h"
#import <UIImageView+WebCache.h>
@implementation PKProductMainListTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _mainImageView = [[UIImageView alloc]init];
        _mainImageView.frame = CGRectMake(10, 10, SCREEN_WITDTH-20, 300*(SCREEN_WITDTH-20)/608);
        [self.contentView addSubview:_mainImageView];
        
        CGFloat lbY = _mainImageView.frame.size.height + 20;
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, lbY, 200, 20)];
        [self.contentView addSubview:_titleLabel];
        _buyButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_buyButton setTitle:@"立即购买" forState:UIControlStateNormal];
        [_buyButton setTitleColor:[UIColor orangeColor] forState:UIControlStateNormal];
        _buyButton.frame = CGRectMake(SCREEN_WITDTH-80, lbY, 80, 20);
        [self.contentView addSubview:_buyButton];
    }
    return self;
};

//重写setter方法  然后在setter内部给cell控件赋值
-(void)setConfigureModel:(PKProductMainListModel *)configureModel
{
    _configureModel = configureModel;
    [_mainImageView sd_setImageWithURL:[NSURL URLWithString:configureModel.coverimg]];
    _titleLabel.text = configureModel.title;
    
    
}

+(CGFloat)heightForCell
{
    return 300*(SCREEN_WITDTH-20)/608 + 10 +40;
}









- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
